<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/common/taglibs.jsp"%>

<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no" />
    <meta name="apple-mobile-web-app-capable" content="yes" />
    <meta name="apple-mobile-web-app-status-bar-style" content="black" />
    <meta name="format-detection"content="telephone=no, email=no" />
    <title>一呼百应</title>
	<script>
	    javascript:window.history.forward(1);   
	</script>
    <link rel="stylesheet" href="${basePath}/css/common.css?v=1106">
    <link rel="stylesheet" href="${basePath}/css/style.css?v=1106">
</head>

<body id="body">
	<div class="page">
        <div class="banner">
            <ul class="clearfix">
                <li><a href="#"><img src="/images/vip.jpg" alt="vip"></a></li>
            </ul>
            <div class="scroll-dot"></div>
            <img src="/images/share.png" class="share" alt="分享">
        </div>
        <div class="vip-company">
        	<ul id="company-list">
	        	
            </ul>
        </div>
    </div>
    <footer>
        <h1>服务热线：020-62307188</h1>
    </footer>
	
<script src="${basePath}/js/zepto.min.js"></script>
<script src="${basePath}/js/vip.js?v=1106"></script>
<script>
	var pageNo = 0;
	
	var isAjax = true;

	$(document).ready(function(){//DOM的onload事件
		show();
	});

	$(window).scroll( function() {//定义滚动条位置改变时触发的事件。
		 // 当滚动到最底部以上100像素时， 加载新内容  
		if(! isAjax){
			return;
		}
		if ($(document).height() - $(this).scrollTop() - $(this).height() < 50) {
			show();//如果是，调用show函数加载内容。
		}
	});

	function show(){
		var nowPage = pageNo;
		pageNo = Number(pageNo) + 1;
		$.ajax({
			url : "/vip/list",
			type : "post",
			data : "pageNo="+pageNo,
			cache : false,
			beforeSend:function(){ 
	            //alert('远程调用开始...'); 
				isAjax = false;
	        }, 
			success : function(data) {
				if(data.indexOf("company-no") > 0){
					pageNo = nowPage;
				}
				$("#company-no").remove();
				$("#company-list").append(data);//用append方法追加内容到mypage元素。
				isAjax = true;
			},
			complete:function(){ 
				isAjax = true;
			},
			error:function() {
				pageNo = nowPage;
				isAjax = true;
			}
		});
	}

	function toWechatShop(username, openid){
		var url = "http://wx.youboy.com/3g.php?m=youboy&ac=index&sp_account="+username.toLowerCase();
		if(typeof(openid) != "undefined" && openid != null && openid != ""){
			url = "/help/callBack?openid="+openid+"&redirect_url="+encodeURIComponent(url);
		}
		window.location.href=url;
	}
</script>

</body>
</html>